/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package db;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author devashish
 */
@Entity
@Table(name = "results")
@NamedQueries({
    @NamedQuery(name = "Results.findAll", query = "SELECT r FROM Results r"),
    @NamedQuery(name = "Results.findByWordId", query = "SELECT r FROM Results r WHERE r.resultsPK.wordId = :wordId"),
    @NamedQuery(name = "Results.findByLabelId", query = "SELECT r FROM Results r WHERE r.resultsPK.labelId = :labelId")})
public class Results implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ResultsPK resultsPK;
    @JoinColumn(name = "LabelId", referencedColumnName = "LabelId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Label label;
    @JoinColumn(name = "WordId", referencedColumnName = "WordId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Word word;
    @JoinColumn(name = "LabelId", referencedColumnName = "LabelId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Label label1;
    @JoinColumn(name = "WordId", referencedColumnName = "WordId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Word word1;

    public Results() {
    }

    public Results(ResultsPK resultsPK) {
        this.resultsPK = resultsPK;
    }

    public Results(long wordId, long labelId) {
        this.resultsPK = new ResultsPK(wordId, labelId);
    }

    public ResultsPK getResultsPK() {
        return resultsPK;
    }

    public void setResultsPK(ResultsPK resultsPK) {
        this.resultsPK = resultsPK;
    }

    public Label getLabel() {
        return label;
    }

    public void setLabel(Label label) {
        this.label = label;
    }

    public Word getWord() {
        return word;
    }

    public void setWord(Word word) {
        this.word = word;
    }

    public Label getLabel1() {
        return label1;
    }

    public void setLabel1(Label label1) {
        this.label1 = label1;
    }

    public Word getWord1() {
        return word1;
    }

    public void setWord1(Word word1) {
        this.word1 = word1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (resultsPK != null ? resultsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Results)) {
            return false;
        }
        Results other = (Results) object;
        if ((this.resultsPK == null && other.resultsPK != null) || (this.resultsPK != null && !this.resultsPK.equals(other.resultsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "db.Results[resultsPK=" + resultsPK + "]";
    }

}
